﻿using Financial.Business;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Financial.Entity;

namespace Financial.WebApi.ViewModels
{
    public class IncomeRowVm
    {
        public int id { get; set; }
        public string[] cell { get; set; }

        public IncomeRowVm(int id, Income income)
        {
            this.id = id;
            cell = new string[]
            {
                CheckNull(income.FamilyMember.FullName) ,
                CheckNull(income.Wage),
                CheckNull(income.MealTicket),
                CheckNull(income.Bonus),
                CheckNull(income.Date.ToShortDateString()),
                $"Income/Edit/{income.Id}"
            };
        }

        private static string CheckNull(object value)
        {
            if (value == null)
            {
                return "-";
            }

            return value.ToString();
        }
    }
}